package com.parfinex.java.phase1.module1.code;
//编程找出1000以内的所有完数并打印出来
public class PerfectNumber {
    public static void main(String[] args){
        int sum = 0;//定义一下因子求和的默认值
        int i =2, j =1;
        for(i =2; i<=1000;i++) {
            for (j = 1; j < i; j++) {
                if (i % j == 0)
                    sum += j;
            }
            if (sum == i)
                System.out.println("" + sum);
            sum = 0;
        }
    }
}
